package com.jk.service.impl;

import com.jk.bean.Content;
import com.jk.bean.Wb;
import com.jk.mapper.AddWbMapper;
import com.jk.service.AddWbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

@Service
public class AddWbSerivceImpl implements AddWbService {
    @Autowired
   private  AddWbMapper addWbMapper;
    @Autowired
    private MongoTemplate mongoTemplate;
    @Override
    public void addwb(Wb wb) {
        Content content = new Content();
        content.setAuthorid(wb.getId());
        content.setText(wb.getWenzhang());
        content.setBtname(wb.getBkname());
        content.setTablename(wb.getTablename());
        content.setAuthorname(wb.getBzname());
        mongoTemplate.save(content,"content");
        addWbMapper.addwb(wb);

    }

    @Override
    public Integer selectPl(Integer authorid) {

        return addWbMapper.selectPl(authorid);
    }


}
